<template>
  <div class="content">
    <div class="cmt-item" v-for="(item, index) in data.data" :key="index">
      <div class="cmt-info">
        <img
          :src="$axios.defaults.baseURL + item.account.defaultAvatar"
          alt=""
        />
        {{ item.account.nickname }} <i>2020-10-12 3:59</i
        ><span>{{ item.level }}</span>
      </div>
      <div class="cmt-content">
        <CommentBlackchild
          v-if="item.followed.length > 0"
          :data="item.followed"
        />
        <div class="cmt-new" @mouseover="show = index" @mouseout="show = false">
          <p class="cmt-message">{{ item.content }}</p>
          <el-row type="flex">
            <div class="cmt-pic" v-if="item.pics.length !== 0">
              <img
                v-for="(v, i) in item.pics"
                :key="i"
                :src="$axios.defaults.baseURL + v.url"
                alt=""
              />
            </div>
          </el-row>

          <div class="cmt-ctrl">
            <a
              href="javascript:;"
              :class="{ none: show !== index }"
              @click="sendcontent(item.id)"
              >回复</a
            >
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['data'],
  data() {
    return {
      show: true,
      postId: ''
    };
  },
  watch: {

  },
  mounted() {
    console.log(this.data);
  },
  methods: {
    sendcontent(id) {
      // console.log(id);
      this.postId = id;
      this.$emit('sendId', id);
    }
  }
};

</script>

<style lang="less" scoped>
.none {
  display: none;
}
.cmt-item {
  border-bottom: 1px dashed #ddd;
  padding: 20px 20px 5px;
  .cmt-info {
    margin-bottom: 10px;
    font-size: 12px;
    color: #666;
    img {
      width: 16px;
      height: 16px;
      border-radius: 50%;
    }
    i {
      color: #999;
    }
    span {
      float: right;
    }
  }
  .cmt-content {
    padding: 0 0 0 30px;
    .cmt-message {
      margin-top: 10px;
    }
    .cmt-pic {
      width: 80px;
      height: 80px;
      border-radius: 6px;
      overflow: hidden;
      margin-right: 5px;
      margin-top: 10px;
      padding: 5px;
      border: 1px dashed #ddd;
      img {
        display: block;
        width: 100%;
        height: 100%;
        -o-object-fit: cover;
        object-fit: cover;
        cursor: pointer;
      }
    }
    .cmt-ctrl {
      height: 20px;
      line-height: 20px;
      font-size: 12px;
      color: #1e50a2;
      text-align: right;
    }
  }
}
</style>
